<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
	<title>登录</title>
	<script src="js/jquery-3.1.1.min.js"></script>
	<script src="js/app-common.js"></script>
	<script>
		var params = getParams();

		$(function() {
			localStorage.removeItem('token');

			$.ajax({
				url: APP_CONFIG.wxLoginUrl,
				type: "post",
				data: {
					"openid": params.openid
				},
				success: function(res) {
					var token = res.data.token;

					if (token) {
						localStorage.setItem('token', token);
						if (params.redirect_uri) {
							location.replace(params.redirect_uri);
						} else {
							history.back();
						}
					}

					$('#msg').text(token ? '登录成功' : '登录失败');
				}
			});
		});
	</script>
</head>
<body>
	<div class="content">
		<h2 id="msg" style="text-align:center; line-height: 300px;">正在登录</h2>
	</div>
</body>
</html>